#!/bin/bash
path_dir=${PWD}

source ${path_dir}/../../shrc

for files_dir in "${path_dir}"/*;do
        if [ -d "${files_dir}" ];then
		test="$(basename "${files_dir}")"
		echo "${test}"
		pushd ${files_dir}/src
		source ../execInfo
		filename=$(find -name "${test}.*")
		exe_file="$(basename "${filename}")"
                	if [ ! -f "${files_dir}/src/${test}" ];then
                		fcc ${files_dir}/src/${exe_file} -p ${files_dir}/src/${test}
                	fi

                	if [ -f "${files_dir}/src/${test}" ];then
                       		{ time NUM_WORKERS=4 ${files_dir}/src/${test} ${TESTARG}; } 2>${files_dir}/src/time.txt
                	fi
			if [ -f "${files_dir}/src/time.txt" ];then
				while read line
				do
					xx=${test}','${line}
					echo ${xx} >> "${path_dir}/test_time.csv"
				done <"${files_dir}/src/time.txt"
			fi

		popd
        fi
done
sed -i 's/ 0m/,0m/g' "${path_dir}/test_time.csv"
